 
export function sendComponentValueChangeRequest(component,data) {
	var eventType;
	if (component.componentModel.onChange === true) {
		eventType = "changeEvent";
	} else if (component.componentModel.componentValueChangeSystem === true) {
		eventType = "componentValueChangeSystemEvent";
	}
	if (eventType == undefined) {
		return;
	}
	
	var pageComponent = component.$parent;
	while (pageComponent.componentModel == undefined || (pageComponent.componentModel.type != "page" && pageComponent.componentModel.type != "dialog")) {
		pageComponent = pageComponent.$parent;
	}
	if(data==undefined){
		data={};
	}
	var id=component.componentModel.id;
	if(component.componentModel.oldId!=undefined){
		id=component.componentModel.oldId;
	}
	var requestConfig={
		"eventSource":id,
		"eventType":eventType,
		"data":data
	}
	pageComponent.sendRequest(requestConfig);
}

export function sendComponentEventRequest(component,eventType,data){
	var pageComponent = component.$parent;
	while (pageComponent.componentModel == undefined || (pageComponent.componentModel.type != "page" && pageComponent.componentModel.type != "dialog")) {
		pageComponent = pageComponent.$parent;
	}
    var requestConfig={
		"eventSource":component.componentModel.id,
		"eventType":eventType,
		"data":data
	}
    
	pageComponent.sendRequest(requestConfig);
}